<%--
  Created by IntelliJ IDEA.
  User: 17728
  Date: 2020/10/15
  Time: 10:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<html>
<head>
    <title>Title</title>
    <%@ include file="/pages/common/head.jsp" %>

    <style type="text/css">
        .upstu {
            width: 60vw;
            margin: 0 auto;
            position: relative;
            top: 100px;
        }

        .head {
            text-align: center;
            position: relative;
            top: 100px;
        }

        #bottom {
            width: 100%;
            height: 180px;
            position: relative;
            top: 200px;
            background-color: #2A2730;
            color: #FFFFFF;
        }

        #bottom p {
            text-align: center;
        }

    </style>
</head>
<script type="text/javascript">
    function fun() {
        $.ajax({
            url: "http://localhost:8080/Work_war_exploded/ClassServlet",
            data: {action: "queryClass"},
            type: "GET",
            success: function (data) {
                var jsonObj = JSON.parse(data);
                var str = "";
                $.each(jsonObj, function (index, classes) {
                    str = $("<option />");
                    str.html(classes.cname);
                    str.val(classes.id);
                    $("#class_id").append(str);
                })

            },
            dataType: "text"
        });
    }


</script>
<body onload="fun()">
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">&nbsp;&nbsp;&nbsp;作业棒&nbsp;&nbsp;&nbsp;</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">

                <li><a href="NoticeServlet?action=page&pageNo=1">学生界面</a></li>
                <li><a href="HwServlet?action=queryHwStu">下载作业</a></li>
                <li><a href="HwServlet?action=queryHw">提交作业</a></li>
                <li class="active"><a href="StudentServlet?action=query">个人信息<span class="sr-only">(current)</span></a>
                </li>
                <li><a href="pages/student/student_change.jsp">修改密码</a></li>

            </ul>

            <ul class="nav navbar-nav navbar-right">
                <li><a href="UserServlet?action=logout">&nbsp;&nbsp;&nbsp;退出&nbsp;&nbsp;&nbsp;</a></li>


            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<body>
<div class="head"><h3>学生信息修改</h3></div>
<div class="upstu">
    <form action="StudentServlet" method="post">
        <input type="hidden" name="action" value="${empty sessionScope.student?"saveStudent":"updateStudent"}">
        <div class="form-group">
            <label for="sNo">学号</label>
            <input type="text " class="form-control" id="sNo" placeholder="sNo" name="sNo"
                   value="${requestScope.studentClass.sNo}">
        </div>
        <div class="form-group">
            <label for="sname">姓名</label>
            <input type="text " class="form-control" id="sname" placeholder="sname" name="sname"
                   value="${requestScope.studentClass.sname}">
        </div>
        <div class="form-group">
            <label for="age">年龄</label>
            <input type="text " class="form-control" id="age" placeholder="age" name="age"
                   value="${requestScope.studentClass.age}">
        </div>
        <div class="form-group">
            <label for="email">邮箱</label>
            <input type="text" class="form-control" id="email" placeholder="email" name="email"
                   value="${requestScope.studentClass.email}">
        </div>
        <div class="form-group">
            <label for="qq">qq</label>
            <input type="text" class="form-control" id="qq" placeholder="qq" name="qq"
                   value="${requestScope.studentClass.qq}">
        </div>
        <div class="form-group">
            <label for="class_id">班级</label>
            <select class="form-control" id="class_id" name="class_id">
                <option value="${requestScope.studentClass.class_id}"
                        selected>${requestScope.studentClass.cname}</option>
            </select>
        </div>
        <button type="submit" class="btn btn-default">确认并返回主页</button>
    </form>
</div>
<%@include file="/pages/common/footer.jsp" %>
</body>
</html>
